<include file="Common:header" />
<body>
	
		<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
			<tr >
			<th align="left" height="30" colspan="2">[<{$invertory['prosku']}>]库存值:
				[<span id="invertory"><{$invertory['proinventory']}></span>]
			</th>
			</tr>
			<tr><td>&nbsp;</td><td> </td></tr>
			<tr>
			
				<td height="30" >
				<form id="form1" name="form1" method="post"
		action="<{:U('inventoryupdate')}>">
				库存加减：<select name="type" id="type"><option
							value="+">+</option>
						<option value="-">-</option>
				</select>库存量：
				<input type="text" name="proinventory" id="proinventory" size="6" value="" />
					
					<input type="hidden" name="skuid" id="skuid" value="<{$skuid}>" />
					
					<input type="submit" name="button" id="button" value="更新" />
				</form>
					</td>
					
				
			</tr>
			<tr>
			<td>
			<form id="form2" name="form2" method="post" action="<{:U('inventoryupdate2')}>">
				直接修改库存量： 
				 <input type="text" name="proinventory" id="proinventory2" size="12" value="" />
					
					<input type="hidden" name="skuid" id="skuid" value="<{$skuid}>" />
					
					<input type="submit" name="button" id="button" value="直接修改" />
			</form>		
				</td>
			</tr>
			<tr>
				<td></td>
				<td height="30" colspan="2">
					<div
						style="font-family: 微软雅黑, Tahoma; letter-spacing: 2px; display: block;"
						id="result"></div>
				</td>
			</tr>
		</table>

		<table width="600" border="0" cellspacing="0" cellpadding="0"
			align="center">
			<tr style="background: #EEE;">
				<td colspan="4" height="30" align="center">库存更新记录</td>
			</tr>
			<tr>
				<td height="30">序号</td>
				<td>操作人</td>
				<td>库存值</td>
				<td>时间</td>
			</tr>
			<volist name="invertorylog" id="log">
			<tr>
				<td height="30"><{$log['id']}></td>
				<td><{$log['seller_nick']}></td>
				<td><{$log['proinventory']}></td>
				<td><{$log['addtime']}></td>
			</tr>
			</volist>

			<tr>
				<td></td>
				<td height="30" colspan="2">
					<div
						style="font-family: 微软雅黑, Tahoma; letter-spacing: 2px; display: block;"
						id="result"></div>
				</td>
			</tr>
		</table>

	

	<script>
		// FROM  Submit 

		$('#form1').ajaxForm({
			beforeSubmit : checkForm, // pre-submit callback
			success : complete, // post-submit callback
			dataType : 'json'
		});
		function checkForm() {
			var proinventory = $("#proinventory").val();
			 
			if( proinventory == ''  || !proinventory.match(/^\d+?$/) ){
				$("#proinventory").val("").focus();
				return false;
			}
			
			//可以在此添加其它判断
		}
		function complete(data) {
			if (data.status == 1) {
				$('#result').html(data.info).show().fadeOut(2000);
			} else {
				$('#result').html(data.info).show();
			}
		}
		
		
		
		$('#form2').ajaxForm({
			beforeSubmit : checkForm2, // pre-submit callback
			success : complete, // post-submit callback
			dataType : 'json'
		});
		function checkForm2() {
			var proinventory = $("#proinventory2").val();
			 
			if( proinventory == ''  || !proinventory.match(/^\d+?$/) ){
				$("#proinventory2").val("").focus();
				return false;
			}
			
			//可以在此添加其它判断
		}
		function complete(data) {
			if (data.status == 1) {
				$('#result').html(data.info).show().fadeOut(2000);
			} else {
				$('#result').html(data.info).show();
			}
		}
	</script>
</body>
</html>
